support agent jdk injection#2825
Conversation
748b13a to
23943ce
Compare
|
Would you mind taking a look at this PR whenever you have a moment? No rush at all. Thank you so much! |
| </p> | ||
|
|
||
| <p> | ||
| When enabled, the init container copies the JDK from <code>/opt/java/openjdk</code> to <code>/jenkins-agent/jdk</code> |
There was a problem hiding this comment.
Interesting thought but this assumes that
- the stock agent image includes a JRE in the specified location (at least CloudBees CI overrides the default image with a different one based on UBI, just sharing the launcher script with the OSS version)
- the JRE uses only shared libraries also present in the selected agent image, and in compatible versions
This seems fragile.
There was a problem hiding this comment.
Thanks for your review
The same concern actually applies to agentInjection itself — PR #2823 was opened specifically because the default agent image is glibc-based and breaks on Alpine (musl) containers. That was addressed by adding agentInjectionImage to let users pick a compatible image.
agentJdkInjection follows the same pattern: it's an opt-in feature, and users pairing it with an Alpine-compatible agentInjectionImage (e.g. jenkins/inbound-agent:...-alpine-jdk21) would naturally get a JDK at /opt/java/openjdk too, since that path is standard for Eclipse Temurin across both glibc and Alpine images.
Let me know if you still have concerns.
Fix #2824
Testing done
SOLUTION
Add agentJdkInjection field that injects JDK from the agent image at runtime.
Toolchain images no longer need Java - they stay pure build environments.
BENEFITS
USAGE
Jenkins UI configuration:
☑ Inject Jenkins agent in agent container
☑ Inject JDK from agent image
Pod template:
Result: JDK injected at pod startup, agent runs with injected Java
BACKWARD COMPATIBILITY
TRADE-OFFS
Here is the template config

Here is the job output
Submitter checklist